<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */
namespace App\Goods\Request;

use Mine\MineFormRequest;

/**
 * 商品规格验证数据类
 */
class GoodsSkuRequest extends MineFormRequest
{
    /**
     * 公共规则
     */
    public function commonRules(): array
    {
        return [];
    }

    
    /**
     * 新增数据验证规则
     * return array
     */
    public function saveRules(): array
    {
        return [
            //商品sku唯一标识 (由规格id组成) 验证
            'goods_sku_id' => 'required',
            //商品ID 验证
            'goods_id' => 'required',
            //规格图片ID 验证
            'image_id' => 'required',
            //商品sku编码 验证
            'goods_sku_no' => 'required',
            //商品价格 验证
            'goods_price' => 'required',
            //商品划线价 验证
            'line_price' => 'required',
            //当前库存数量 验证
            'stock_num' => 'required',
            //商品重量(Kg) 验证
            'goods_weight' => 'required',
            //SKU的规格属性(json格式) 验证
            'goods_props' => 'required',
            //规格值ID集(json格式) 验证
            'spec_value_ids' => 'required',

        ];
    }
    /**
     * 更新数据验证规则
     * return array
     */
    public function updateRules(): array
    {
        return [
            //商品sku唯一标识 (由规格id组成) 验证
            'goods_sku_id' => 'required',
            //商品ID 验证
            'goods_id' => 'required',
            //规格图片ID 验证
            'image_id' => 'required',
            //商品sku编码 验证
            'goods_sku_no' => 'required',
            //商品价格 验证
            'goods_price' => 'required',
            //商品划线价 验证
            'line_price' => 'required',
            //当前库存数量 验证
            'stock_num' => 'required',
            //商品重量(Kg) 验证
            'goods_weight' => 'required',
            //SKU的规格属性(json格式) 验证
            'goods_props' => 'required',
            //规格值ID集(json格式) 验证
            'spec_value_ids' => 'required',

        ];
    }

    
    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'id' => '记录ID',
            'goods_sku_id' => '商品sku唯一标识 (由规格id组成)',
            'goods_id' => '商品ID',
            'image_id' => '规格图片ID',
            'goods_sku_no' => '商品sku编码',
            'goods_price' => '商品价格',
            'line_price' => '商品划线价',
            'stock_num' => '当前库存数量',
            'goods_weight' => '商品重量(Kg)',
            'goods_props' => 'SKU的规格属性(json格式)',
            'spec_value_ids' => '规格值ID集(json格式)',
            'store_id' => '商城ID',

        ];
    }

}